<?php

class SyncEventCallbackData extends CoreController {

    public function execute() {
        $eventDataInterpreterService = $this->CORE->loader->service('EventDataInterpreterService');
        $eventContentRouterService = $this->CORE->loader->service('EventContentRouterService');
        while (TRUE) {
            $interpretRes = $eventDataInterpreterService->execute();
            if (!$interpretRes->success) {
                sleep(1);
                continue;
            }
            $eventContentRouterService->execute($interpretRes->data['event_type'], $interpretRes->data['content']);
        }
    }

/*    private function startProcess() {
        for($i = 0; $i < $worker_num; $i++) {
            $process = new \swoole_process([$this, 'consume'], FALSE, FALSE);
            $process->useQueue();
            $pid = $process->start();
            $workers[$pid] = $process;
        }
    }

    private function consume() {
        $eventContentRouterService = $this->CORE->loader->service('EventContentRouterService');
        while(TRUE) {
            $data =             
        }
        $eventContentRouterService->execute($interpretRes->data['event_type'], $interpretRes->data['content']);
    }*/
}
